package operation;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 王圆豪
 * Date: 2024-05-25
 * Time: 19:58
 */
public class ReturnBook implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书....");
        System.out.println("请输入书名：");
        Scanner sc = new Scanner(System.in);
        String fname = sc.nextLine();
        for (int i = 0; i < bookList.getEffnum(); i++) {
            if (bookList.getBooks(i).getName().equals(fname)) {
                bookList.getBooks(i).setState(false);
                System.out.println("《" + bookList.getBooks(i).getName() + "》归还成功！！！");
                return;
            }
        }
        System.out.println("没有这本书！！！");
    }
}
